// pm2 config

module.exports = {
	apps: [
		{
			name: 'pm2-deploy',
			script: 'app.js',
			exec_mode: 'cluster',
			max_memory_restart: '150M',
			env: {
				MASTER: 'luoob'
			},
			env_production: {
				NODE_ENV: 'production'
			}
		}
	],
	deploy: {
		production: {
			user: 'root',                                                   // 服务器登录用户名
			host: ['10.211.55.6'],                                          // 服务器 ip 地址
			ref: 'origin/master',                                            // 远程分支
			repo: 'git@gitee.com:luoob/pm2-deploy.git',                     // 远程仓库地址
			path: '/var/www/deploy',                                        // 服务器部署的目录
			'pre-setup': "echo 'This is a pre-setup command'",              // 更新或者 clone 仓库前
			'post-setup': 'ls -la',                                         // 更新或者 clone 仓库后
      'pre-deploy': "echo 'This is a pre-deploy command'",
			'pre-deploy-local': "echo 'This is a pre-deploy-local command'",
			'post-deploy': 'yarn install && pm2 restart ecosystem.config.js'
		}
	}
}
